from flask import Flask, jsonify
from flask import render_template
from flask import request
app = Flask(__name__)
# 使通过jsonify返回的中文显示正常，否则显示为ASCII码
# app.config["JSON_AS_ASCII"] = False

@app.route('/json1', methods=['GET'])
def json_demo1():
    user = request.args.get('user')
    return {"code": 0, "data": user, "msg": "查询成功"}

@app.route('/json2', methods=['GET'])
def json_demo2():
    user = request.args.get('user')
    return jsonify({"code": 0, "data": user, "msg": "查询成功"})

if __name__ == '__main__':
    app.run(debug=True)